package com.wuyou.sso.common.enums;

import cn.hutool.core.util.EnumUtil;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.wuyou.sso.common.annotation.DictValue;
import com.wuyou.sso.common.annotation.Label;
import com.wuyou.sso.common.annotation.MapDict;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 用户状态
 *
 * @author zhengzhouyi
 * @date 2023-7-24
 */
@RequiredArgsConstructor
@MapDict(code = "user-status",name = "用户状态")
public enum UserStatusEnum implements IEnum<Integer> {
    /**
     * 离线
     */
    @Label("离线")
    OFF_LINE(0, "离线"),
    /**
     * 上线
     */
    @Label("上线")
    TOP_LINE(1, "上线"),
    /**
     * 停用
     */
    @Label("停用")
    STOP(2, "停用"),
    /**
     * 删除
     */
    @Label("删除")
    DELETE(3, "删除");

    /**
     * 类型
     */
    @DictValue
    private final Integer type;

    /**
     * 描述
     */
    @JsonValue
    @Getter
    private final String description;

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static UserStatusEnum getEnum(Object value) {
        return EnumUtil.likeValueOf(UserStatusEnum.class, value);
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

}
